import java.util.ArrayList;
import java.util.Random;

/**
 * @author: ybb
 * @date: 3/28/0028 9:06
 * @description：获取10个1-40之间的随机数，要求不能重复
 */
public class Task05 {
    public static void main(String[] args) {

        Random r=new Random();
        ArrayList array=new ArrayList();
        int count=0;
        while (count<10){
            int number=r.nextInt(40)+1;
            if(!array.contains(number)){
                array.add(number);
                count++;
            }
        }
        for (Object obj:array ) {
            System.out.print(obj+"\t");
        }
    }
}
